package com.jenings.shop.service;

import com.jenings.shop.entity.Shopping;
import com.jenings.shop.mapper.ShoppingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoppingServices {
    @Autowired
    ShoppingMapper shoppingMapper;
    //查询全部商品
    public List<Shopping> selectAll(){
        List<Shopping> shoppingList = shoppingMapper.selectAll();
        return shoppingList;
    }
    //查询部分商品,模糊查询
    public List<Shopping> selectSome(String spname){
        List<Shopping> shoppingList = shoppingMapper.selectSome(spname);
        return shoppingList;
    }
    //查询指定商品
    public Shopping selectByte(String spname){
        Shopping shopping = shoppingMapper.selectByte(spname);
        return shopping;
    }
    //修改商品信息
    public boolean updateByte(Shopping shopping){
        return shoppingMapper.updateByte(shopping);
    }
    //添加商品
    public boolean addByte(Shopping shopping){
        return shoppingMapper.addByte(shopping);
    }
    //删除商品
    public boolean delByte(Integer spid){
        return shoppingMapper.delByte(spid);
    }
}
